package com.htc.dao;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.htc.model.User;

public interface UserMapper {
    
	@Select("SELECT * from sys_user where login_name = #{login_name} and login_password = #{login_password}")
    List<User> login(User user);
    
	@Delete("delete from sys_user where uuid=#{id}")
    int del(int id);

    @Insert("insert into sys_user(login_name,login_password,nick_name,sex,phone,identity) values(#{login_name},#{login_password},#{nick_name},#{sex},#{phone},#{identity}) ")
    int insert(User user);

    @Update("update sys_user set sex=#{sex},login_name=#{login_name},login_password=#{login_password},nick_name=#{nick_name},phone=#{phone},identity=#{identity} where uuid=#{uuid} ")
    int update(User user);
    
    @Select("SELECT * from sys_user ${where}")
    List<User> queryList(@Param("where")String where);
    
    @Update("update sys_user set login_password=#{login_password} where uuid=#{uuid}")
    void updatePassword(@Param("uuid")Integer uuid, @Param("login_password")String password);
}